package com.approval.approvalapp.index.dbsx.ptbl.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.approval.approvalapp.R;
import com.approval.approvalapp.bean.PtblXqBean;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by louyulin on 2019/4/30.
 */

public class PtblxqAdapter extends RecyclerView.Adapter<PtblxqAdapter.Holder> {

    List<PtblXqBean.BlyjShowBean> blyjShowBeanList;
    Context context;

    public void setBlyjShowBeanList(List<PtblXqBean.BlyjShowBean> blyjShowBeanList) {
        this.blyjShowBeanList = blyjShowBeanList;
        notifyDataSetChanged();
    }

    @Override
    public Holder onCreateViewHolder(ViewGroup parent, int viewType) {
        context = parent.getContext();
        View view = LayoutInflater.from(context).inflate(R.layout.item_jg, parent, false);
        Holder holder = new Holder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(Holder holder, int position) {
        holder.tv1.setText(blyjShowBeanList.get(position).getUSER_NAME());
        holder.tv2.setText(blyjShowBeanList.get(position).getCURRENT_NODE_NAME());
        holder.tv3.setText(blyjShowBeanList.get(position).getSEND_TIME());
        holder.tv4.setText("办理意见： " + blyjShowBeanList.get(position).getOPINION());
        holder.index_tv.setText((position + 1) + "");

    }

    @Override
    public int getItemCount() {
        if (blyjShowBeanList == null) {
            return 0;
        } else {
            return blyjShowBeanList.size();
        }
    }

    class Holder extends RecyclerView.ViewHolder {
        @Bind(R.id.tv1)
        TextView tv1;
        @Bind(R.id.tv2)
        TextView tv2;
        @Bind(R.id.tv3)
        TextView tv3;
        @Bind(R.id.v1)
        View v1;
        @Bind(R.id.tv4)
        TextView tv4;
        @Bind(R.id.index_tv)
        TextView index_tv;

        public Holder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }

}
